//
//  GroupImagesEditorCCell.m
//  jsy
//
//  Created by  任辰东 on 2020/4/15.
//  Copyright © 2020 JSY. All rights reserved.
//

#import "GroupImagesEditorCCell.h"
#import "UIButton+TouchAreaInsets.h"

@interface GroupImagesEditorCCell ()

@end

@implementation GroupImagesEditorCCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self setupViews];
    }
    return self;
}

- (void)setupViews
{
    [self.contentView addSubview:self.imageView];
    [self.contentView addSubview:self.deleteBtn];
    
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.edges.equalTo(self.contentView);
    }];
    
    [self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).offset(-7.5);
        make.right.equalTo(self.contentView).offset(7.5);
        make.height.width.mas_equalTo(30);
    }];
}

#pragma mark -- lazyload

-(UIImageView *)imageView
{
    if (!_imageView) {
        _imageView = [[UIImageView alloc] init];
        _imageView.backgroundColor = [UIColor colorWithWhite:1.000 alpha:0.500];
        _imageView.contentMode = UIViewContentModeScaleAspectFill;
        _imageView.clipsToBounds = YES;
        _imageView.userInteractionEnabled = YES;
    }
    return _imageView;
}

-(UIButton *)deleteBtn
{
    if (!_deleteBtn) {
        _deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_deleteBtn setImage:[UIImage imageNamed:@"image_delete"] forState:UIControlStateNormal];
//        _deleteBtn.imageEdgeInsets = UIEdgeInsetsMake(-10, 0, 0, -10);
//        _deleteBtn.alpha = 0.6;
//        [_deleteBtn setTouchAreaInsets:UIEdgeInsetsMake(20, 20, 20, 20)];
    }
    return _deleteBtn;
}


@end
